package com.fh.area.controller;

import com.fh.area.FullData;
import com.fh.area.service.AreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 宋闯胜
 * @PackageName:com.fh.controller
 * @ClassName: AreaController
 * @Description:
 * @date 2021/11/10 13:38
 */
@RestController
@RequestMapping("area")
@CrossOrigin
public class AreaController {
    @Autowired
    private RedisTemplate redisTemplate;

    @Resource
    private AreaService areaService;

    @PostMapping("queryAreaData")
    public FullData queryAreaData(){
        return FullData.success(areaService.queryAreaData());
    }

    @PostMapping("redis")
    public FullData redis(){
        String o = (String) redisTemplate.opsForValue().get("area");
        return FullData.success(o)  ;
    }
}
